from ..func.erase_func import EraseOutFunctions


def erase_out(clip, anchor="E", duration=None):
    if duration is None:
        duration = clip.duration
    func = None
    if anchor in ['E', 'W', 'N', 'S']:
        func = EraseOutFunctions.direction(duration, clip.duration, anchor)
    elif anchor in ["C", "OC"]:
        func = EraseOutFunctions.cross(duration, clip.duration, anchor)
    return clip.fl(func, apply_to=["mask"])
